<script setup lang="ts">
import { ref } from 'vue'
// import function to register Swiper custom elements
import { register } from 'swiper/element/bundle';
import { useRouter } from 'vue-router';
import { useRoute } from 'vue-router';
const router = useRouter()
const route = useRoute()
console.log(route)
// register Swiper custom elements
register();
defineProps<{ msg: string }>()

const onProgress = (e: any) => {
    const [, progress] = e.detail;
    console.log(progress)
};

const onSlideChange = (e: any) => {
    console.log('slide changed', e)
}
const push = router.push

const list = ref([{ url: '../assets/img/1686543809.png_thumb.jpg', name: '1九阳空气炸锅 KL45-VF711【尾款到店付】', oriPrice: 201, prePrice: 10, nowPrice: 99, id: 1 },
{ url: '../assets/img/1686543809.png_thumb.jpg', name: '2九阳空气炸锅 KL45-VF711【尾款到店付】', oriPrice: 202, prePrice: 11, nowPrice: 99, id: 2 },
{ url: '../assets/img/1686543809.png_thumb.jpg', name: '3九阳空气炸锅 KL45-VF711【尾款到店付】', oriPrice: 203, prePrice: 12, nowPrice: 99, id: 3 },
{ url: '../assets/img/1686543809.png_thumb.jpg', name: '4九阳空气炸锅 KL45-VF711【尾款到店付】', oriPrice: 204, prePrice: 13, nowPrice: 99, id: 4 },
{ url: '../assets/img/1686543809.png_thumb.jpg', name: '5九阳空气炸锅 KL45-VF711【尾款到店付】', oriPrice: 205, prePrice: 14, nowPrice: 99, id: 5 },
{ url: '../assets/img/1686543809.png_thumb.jpg', name: '6九阳空气炸锅 KL45-VF711【尾款到店付】', oriPrice: 206, prePrice: 15, nowPrice: 99, id: 6 }])
</script>

<template>
    <div class="detail">
        <div class="container_bottom">
            <div class="border_progress" style="width: 0%;"></div>
            <div class="bottom_tab"><span class="bottom_tab_span" @click="push('/')">活动首页</span></div>
            <div class="bottom_tab tab_active"><span class="bottom_tab_span">特价爆款</span></div>
        </div>
        <swiper-container @swiperprogress="onProgress" @swiperslidechange="onSlideChange" direction='vertical'
            class="swiper" loop="true">
            <swiper-slide class="item" v-for="item in list" :key="item.id">
                <div class=""><img :src="item.url" class="product_play" loading="lazy"></div>
                <div class="tools_right tools_right_btm">
                    <div class="tools_r_li" style="display: none;"><img src="../assets/img/product/btn_groupchat.png"
                            class="tag_image tag_image_noborder"></div>
                    <div class="tools_r_li"><img
                            :src="item.url"
                            class="tag_image"></div>
                    <!-- <div class="tools_r_li"><i class="iconfont icon-huo icon_right  "></i>
                        <div class="tools_r_num">1</div>
                    </div> -->
                    <!-- <div class="tools_r_li"><i class="iconfont icon-liuyan icon_right icon_right_change"></i>
                        <div class="tools_r_num"></div>
                    </div> -->
                    <div class="tools_r_li"><a style="color: rgb(255, 255, 255);"><i
                                class="iconfont icon-kefu1 icon_right"></i></a>
                        <div class="tools_r_num"><a style="color: rgb(255, 255, 255);">咨询客服</a></div>
                    </div>
                    <!-- <div class="tools_r_li"><img src="../assets/img/product/btn_buy.png"
                            class="tag_image tag_image_noborder">
                    </div> -->
                    <div class="tools_r_li"><img src="../assets/img/product/btn_unstart.png"
                            class="tag_image tag_image_noborder"></div>
                    <!-- <div class="tools_r_li"><img src="../assets/img/product/btn_end.png"
                            class="tag_image tag_image_noborder"></div> -->
                    <!-- <div class="tools_r_li"><img src="../assets/img/product/btn_null.png"
                            class="tag_image tag_image_noborder">
                    </div> -->
                </div>
                <div class="production_box">
                    <div class="production_name production_name_mid">
                        {{ item.name }}
                    </div>
                    <div class="production_des production_des_mid">

                    </div>
                    <!-- <div class="production_price">
                        预付金：￥99.00
                    </div> -->
                    <div class="production_number">
                        爆款价格：￥{{ item.nowPrice }} <small>￥{{ item.oriPrice }} </small><br>库存仅剩10件
                    </div>
                </div>
            </swiper-slide>
        </swiper-container>
    </div>
</template>

<style scoped lang="less">
.detail {
    background-color: #000;
}

.container_bottom {
    position: fixed;
    z-index: 2000;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    height: 48px;
    /* border-top: 1px solid rgba(255, 255, 255, 0.7); */
    width: 100%;

    .border_progress {
        width: 0;
        height: 1px;
        background: #bababa;
        position: absolute;
        top: 0;
        transition: .1s all;
    }

    .bottom_tab {
        width: 33%;
        text-align: center;
        float: left;
        color: #c9c9c9;
        padding: 10px 0;
        background: url(../assets/img/split.png) no-repeat right center;
    }

    .bottom_tab:last-child {
        background: url()
    }


    .bottom_tab_icon {
        width: 44px;
    }

    .bottom_tab_span {
        line-height: 28px;
        border-bottom: 2px solid transparent;
        font-weight: 600;
        font-size: 16px;
        display: inline-block;
        padding: 0 4px;
        transition: .5s all;
    }

    .tab_active .bottom_tab_span {
        border-bottom: 2px solid #fff;
        color: #fff;
    }
}

.swiper {
    width: 100vw;
    height: 100vh;
}

.item {

    /* height: 100vh !important;11 */
    .product_play {
        position: absolute;
        margin: auto;
        top: 50%;
        left: 0;
        z-index: 999;
        width: 100%;
        height: 100vw;
        margin-top: -50vw;
    }
}

.production_box {
    z-index: 1001;
    position: absolute;
    /* right: 16px; */
    bottom: 20px;
    text-align: left;
    padding: 0 15px 15px 15px;
    color: #fff;
    width: 100%;
    left: 0;
    box-sizing: border-box;
    background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
    /* Safari 5.1 - 6.0 */
    background: -o-linear-gradient(top, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
    /* Opera 11.1 - 12.0 */
    background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
    /* Firefox 3.6 - 15 */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
    /* 标准的语法 */
}

.production_name {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 10px;
    max-height: 50px;
    line-height: 25px;
    overflow: hidden;
}

.production_price {
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
    width: 70%;
}

.production_number small {
    font-size: 14px;
    font-weight: normal;
    text-decoration: line-through;
}

.production_number {
    font-size: 14px;
    margin-top: 10px;
    width: 70%;
}

.production_des_mid,
.production_name_mid {
    width: 70%;
}

.tools_right {
    z-index: 1009;
    position: absolute;
    right: 16px;
    bottom: 180px
}

.tools_right_btm {
    bottom: 25px
}

.tools_r_li {
    margin-bottom: 20px;
    color: #fff;
    font-size: 14px;
    position: relative;
    text-align: center;
}

.tools_r_li i {
    font-size: 30px;
}

.tools_r_li:last-child {
    margin-bottom: 0px;
}

.icon_right {
    margin-bottom: 5px;
    font-size: 42px;
    display: block;
    text-shadow: 0px 0px 10px #9d9d9d;
    /*transition: .5s;*/
}

/*头像， 点赞，转发 */
.tag_image {
    width: 50px;
    height: 50px;
    border: 1px solid #fff;
    box-sizing: border-box;
    border-radius: 50%;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0px 0px 10px #9d9d9d;
}

.tag_image_noborder {
    border: 0;
}
</style>
